<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html style="font-size: 120px;"><head>
    <title>登录</title>
    <meta charset="UTF-8">
    <meta name="author" content="m.jd.com">
    <meta name="description" content="">
    <meta name="Keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="Expires" content="-1">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Pragma" content="no-cache">
    <link href="nfund.ico" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/moible/static/css/app.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/moible/static/css/new.css">    
    <style>
    .icon-lock{
                /*background-image: url(${pageContext.request.contextPath}/moible/static/images/icon-lock.png);*/
                background-image: url();
                height:1.75em;
                width:1.75em;
                margin:0 .5em;
            }
            .icon-user{
                /*background-image: url(${pageContext.request.contextPath}/moible/static/images/icon-user.png);*/
                background-image: url();
                height:1.75em;
                width:1.75em;
                margin:0 .5em;
            }
            .selBox-user{
                width: 100%;
                background-color: #FFFFFF;
                position: absolute;
                left:0;
                top:3.8em;
                max-height:9em;
                overflow:auto;
                z-index: 9;border-bottom-left-radius: .3em;
                border-bottom-right-radius: .3em;
                border-bottom: 1px solid #dfdfdf;
            }
            .user-item{
                line-height:3em;
                padding-left:3.4em;
                padding-right:1.35em;
                border-top: 1px solid #dfdfdf;
            }
            .sel-icon-rotate{
               transform: rotate(180deg);
               -webkit-transform: rotate(180deg);
            }
             .uinput3 input{
                margin: 0px;
                border: 0px;
                width: 100%;
                height: 100%;
                -webkit-appearance: none;
                padding: .4em .4em;
                background: none;
                text-decoration: none;
                font-size: 1em;
                display: block;
                height: 3em;
                position: relative;
            }
            .ui-form-item {
                position: relative;
                height: 2.5em;
                border-bottom: 1px solid #DFDFDF;
                line-height: 2.5em;
            }
            .ui-form-item .item-left {
                float: left;
                padding-right: 5px;
            }
    </style>
<style>header{display: -webkit-box !important;display: box !important;}#wrapper{padding-top:2.5em;}#content{padding-top:2.5em;}</style><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="m_selectBox" src="./blade/ui/selectBox.js?v=20180615"></script><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="text" src="./blade/libs/require.text.js?v=20180615"></script><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="m_tpl" src="./blade/libs/underscore.min.js?v=20180615"></script><style id="scrollCss">::-webkit-scrollbar-track-piece {background-color: rgba(0, 0, 0, 0); border-left: 1px solid rgba(0, 0, 0, 0);}::-webkit-scrollbar { width: 5px;height: 13px;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;}::-webkit-scrollbar-thumb {  background-color: rgba(0, 0, 0, 0.5); background-clip: padding-box; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; min-height: 28px;}::-webkit-scrollbar-thumb:hover { background-color: rgba(0, 0, 0, 0.5); -webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;}</style></head>
  <body style=""><div class="ub ub-ver ub-ac mask-select uhide " maskname="cerType" style="z-index: 99; position: fixed; top: 0px; right: 0px; bottom: 0px; left: 0px; background-color: rgba(0, 0, 0, 0.4); width: 400px; height: 502px;">
    <div class="ub-f1 btn-selBox-close ub-fh"></div>
    <div class="ub  ub-ver bg-c-wh uc-a1 " style="width:85%">
        <div class="ub" style="border-bottom:1px solid #177ced;">
            <div style="min-width: 2em;"></div>
            <h1 id="title-select" class="ub-f1 ut-s tx-c" style="line-height: 2.5;font-size: 1em;">请选择证件</h1>
            <div class="ub ub-ac btn-selBox-close" style="min-width: 2em">
                <div class="selBox-close ub-img"></div>
            </div>
        </div>
            
        <div id="select-cert" class="ub ub-pc ub-ver " style="line-height: 2.5em;padding-left:1em;">
          <ul style="max-height: 376.5px; overflow-y: scroll;">
            
            
                <li class="ub ub-ac dot">
            
                
                    <input type="radio" checked="" name="radio-cert" class="uhide" data-cname="手机号/身份证" value="0">
                
                <div class="ub ub-f1 select-box-txt ulev34">
                    
                    
                    <div class="ub ub-ac ub-f1  ut-s ">手机号/身份证</div>
                    
                    
                    <div class="icon-radio" style="width:3em;height:3em;"></div>
                </div>
            </li>
            
            
                <li class="ub ub-ac dot">
            
                
                    <input type="radio" name="radio-cert" class="uhide" data-cname="昵称" value="7">
                
                <div class="ub ub-f1 select-box-txt ulev34">
                    
                    
                    <div class="ub ub-ac ub-f1  ut-s ">昵称</div>
                    
                    
                    <div class="icon-radio" style="width:3em;height:3em;"></div>
                </div>
            </li>
            
            
                <li class="ub ub-ac dot">
            
                
                    <input type="radio" name="radio-cert" class="uhide" data-cname="军官证" value="2">
                
                <div class="ub ub-f1 select-box-txt ulev34">
                    
                    
                    <div class="ub ub-ac ub-f1  ut-s ">军官证</div>
                    
                    
                    <div class="icon-radio" style="width:3em;height:3em;"></div>
                </div>
            </li>
            
            
                <li class="ub ub-ac dot">
            
                
                    <input type="radio" name="radio-cert" class="uhide" data-cname="士兵证" value="3">
                
                <div class="ub ub-f1 select-box-txt ulev34">
                    
                    
                    <div class="ub ub-ac ub-f1  ut-s ">士兵证</div>
                    
                    
                    <div class="icon-radio" style="width:3em;height:3em;"></div>
                </div>
            </li>
            
            
                <li class="ub ub-ac dot">
            
                
                    <input type="radio" name="radio-cert" class="uhide" data-cname="户口本" value="5">
                
                <div class="ub ub-f1 select-box-txt ulev34">
                    
                    
                    <div class="ub ub-ac ub-f1  ut-s ">户口本</div>
                    
                    
                    <div class="icon-radio" style="width:3em;height:3em;"></div>
                </div>
            </li>
            
            
                <li class="ub ub-ac dot">
            
                
                    <input type="radio" name="radio-cert" class="uhide" data-cname="警官证" value="9">
                
                <div class="ub ub-f1 select-box-txt ulev34">
                    
                    
                    <div class="ub ub-ac ub-f1  ut-s ">警官证</div>
                    
                    
                    <div class="icon-radio" style="width:3em;height:3em;"></div>
                </div>
            </li>
            
            
                <li class="ub ub-ac dot">
            
                
                    <input type="radio" name="radio-cert" class="uhide" data-cname="中国护照" value="1">
                
                <div class="ub ub-f1 select-box-txt ulev34">
                    
                    
                    <div class="ub ub-ac ub-f1  ut-s ">中国护照</div>
                    
                    
                    <div class="icon-radio" style="width:3em;height:3em;"></div>
                </div>
            </li>
            
            
                <li class="ub ub-ac dot">
            
                
                    <input type="radio" name="radio-cert" class="uhide" data-cname="回乡证" value="4">
                
                <div class="ub ub-f1 select-box-txt ulev34">
                    
                    
                    <div class="ub ub-ac ub-f1  ut-s ">回乡证</div>
                    
                    
                    <div class="icon-radio" style="width:3em;height:3em;"></div>
                </div>
            </li>
            
            
                <li class="ub ub-ac dot">
            
                
                    <input type="radio" name="radio-cert" class="uhide" data-cname="文职证" value="8">
                
                <div class="ub ub-f1 select-box-txt ulev34">
                    
                    
                    <div class="ub ub-ac ub-f1  ut-s ">文职证</div>
                    
                    
                    <div class="icon-radio" style="width:3em;height:3em;"></div>
                </div>
            </li>
            
            
                <li class="ub ub-ac dot">
            
                
                    <input type="radio" name="radio-cert" class="uhide" data-cname="基金账号" value="-1">
                
                <div class="ub ub-f1 select-box-txt ulev34">
                    
                    
                    <div class="ub ub-ac ub-f1  ut-s ">基金账号</div>
                    
                    
                    <div class="icon-radio" style="width:3em;height:3em;"></div>
                </div>
            </li>
            
            </ul>
        </div>
    </div>
    <div class="ub-f1 btn-selBox-close ub-fh"></div>
</div>
  <header>
      <div class="nav-btn" data-btn="close">
          <div class="back" onclick="historyBack();"></div>
      </div>
      <div class="ub-f1" id="header-title" style="text-align: center;">登录</div>
      <div class="nav-btn"></div>
  </header>
      <div id="wrapper" class="up ub ub-ver ub-f1">
        <div style="margin-top: 1.5em;">
            <div class="ub ub-ac ub-f1 bd-b-c1 nf-input " style="border: none;margin-bottom: 0em;padding-left: 1em;">
                <div class="icon-user ub-img"> </div>
                <div class="ub-f1 uinput3">
                    <input placeholder="手机号/身份证" id="lognumber" type="text" class="ub-f1 js-lognumber clearEnabled">
                </div>
                <img src="${pageContext.request.contextPath}/moible/static/images/clear.png" style="width:1.2em;height:1.2em;position: relative;z-index: 9;" class="uhide clearBtn" data-act="input">
                <div class="sel-option js-logn-sel uhide umar_r05" style="transition:rotate 1s;-webkit-transition:rotate 1s; "></div>
                <div class="selBox-user js-logn-userList uhide"></div>
            </div>
            <div class="bd-b-c1"></div>
            <div class="ub-ac ub ub-f1 bd-b-c1 nf-input" style="border: none;padding-left: 1em;">
                <div class="icon-lock ub-img"></div>
                <div class="ub-f1 uinput3">
                    <input placeholder="登录密码/交易密码" id="pwd" type="password" class="ub-f1 js-pwd clearEnabled">
                </div>
                <img src="${pageContext.request.contextPath}/moible/static/images/clear.png" style="width:1.2em;height:1.2em;position: relative;z-index: 9;" class="uhide clearBtn" data-act="input">
            </div>
            <div class="ui-form-item fn-clear c-wh uinput uhide" id="picCodeItem" style="margin:1em 0;">
                <div class="item-left tx-c" style="min-width: 6em;">图形验证码</div>
                <div class="item-right">
                    <input type="text" id="authcode" class="form-input-text" style="width: 50%;" placeholder="请输入图形验证码">
                    <!-- <img src="../imgages/about_nf.png" style="position: absolute;right: 0;top: .8em;height:2.5em; color: #fff;"/> -->
                      <img src="" style="position: absolute;right: 0;top: .8em;height:2.5em; color: #fff;">
                </div>
            </div>
            <div class="ub ub-pj ulev30 t_777" style="padding:1.5em 1em 0 1em;">
                <div class="bd-b-c1 js-cert-select" data-val="0" style="line-height: 1.5em;">其他方式登录</div>
                <div class="bd-b-c1 js-forget-pwd c_007aff" style="line-height: 1.5em;">忘记密码？</div>
            </div>
        </div>
        <div class="btn-submit js-login" style="margin-top: 1.5em;" data-type="0">登录</div>
        <div class="btn-submit js-register" style="border:1px solid #73A8EC;color: #73A8EC;background-color: #FFFFFF;margin-top:0;">注册</div>
        </div>
        <div class="ub-f1"></div>
        <script type="text/javascript" async="" defer="" src="https://wap.southernfund.com:8008/piwik.js"></script><script type="text/javascript" src="blade/libs/zepto.min.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/moible/static/js/config.js"></script>
        <script type="text/javascript" src="blade/libs/require.js"></script>
        <script type="text/javascript" src="blade/common.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/moible/static/js/aes.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/moible/static/js/app.js"></script>
        <script src="${pageContext.request.contextPath}/moible/static/js/piwikTrack.js?v=20170515"></script>
        <script src="${pageContext.request.contextPath}/moible/static/js/quota.js"></script>           
        <script type="text/javascript">
        if(localStorage.getItem('timeout')){
            localStorage.removeItem('timeout')
            clearLocVal("sessionkey,idtype");
        }
        clearLocVal("userList");        
        var loginModule =null,accManage=null;
        var  inputPicCode  = false;//用于标记是否需要输入图形验证码
        
        $(function(){
            piwikInit();
           //免费注册
           $(".js-register").on('click',function(){
               if(sessionStorage.getItem("subChannel")=="ssjz"){
                   location.href = 'oldOpenAccount.html';
               }else{
                   location.href = 'openAccount.html';
               }               
           });
           //其它方式登录
           loginModule = new LoginModule();
           //忘记密码
           $(".js-forget-pwd").on('click',function(){
               location.href = 'findPwd.html';
           });
           $('.back').on('click',function(){
                historyBack();
           });
        });
        var LoginModule = function(){
            this.init = function(){
                //普通登录初始化
                plainInit();
                //事件绑定
                bindLoginEvent();
            };
            this.response = null;
            this.param = {};//登录参数
            this.loginCb= [
                 plainLogin //普通方式登录
            ];
            this.login =function(type){
                var j = this.param;
                toast();
                nfApp._ajax(j, this.loginCb[type]);
            }
            this.init();
        }
        
        var errorCount = 0;//密码输入错误次数
        var loginData = '';
        function plainLogin(data) {
            var self =this;
            closeToast();
            if(inputPicCode==true&&data.code != SUCCESS_FLAG){   
                showPicCode();
            }
            if (data.code == SUCCESS_FLAG) {
                window.localStorage.removeItem('forgetlock');
                accManage.saveUser(data.accountId);
                loginSuccess(data);
            }else if(data.code=='WA-MIF004'){
                setLocVal('accountId',data.accountId);
                sessionStorage.setItem('handset',$(".js-lognumber").val());
                setLocVal('EnPwd',Encrypt($(".js-pwd").val()));
                location.href = 'loginSupplement.html';
            }else if(data.code == 'ETS-9B118'||data.code=='DS-TR050102'){
                    var callback = function(){
                            location.href = 'findPwd.html'
                    };
                    dialog({
                        type : 'confirm',
                        hasTitle : false,
                        content : data.message,
                        button : {
                            cancel : '找回密码',
                            confirm : '确&nbsp定'
                        },
                        cancelCallback : callback,
                        confirmCallback :null
                    });      
            }else{
               dialog({type:'alert',content:data.message});
            }
            //显示图形验证码的情况
            if((data.code == 'ETS-ULT001'|| data.code == 'ETS-9B118'||data.code=='DS-TR050102')&&!inputPicCode){
                inputPicCode  = true;
                showPicCode();
            }
            savePiwikPlainLogin(data);
        }
        function loginSuccess(data){//登录成功统一处理函数
            localStorage.removeItem("safeExit");//清除安全退出
            saveLogin(data);
            canBuy();//设置canbuy标记
            if(sessionStorage.getItem("subChannel")=='ssjz'){
                window.location.href = "xjbDetail.html";
                return;
            }
            if((paramQuery()).autoHref){
                var autoHref = (paramQuery()).autoHref;
                var param = {};
                var locParam =paramQuery()
                var keys = locParam.keys;
                for(var i=0;i<keys.length;i++){//回调参数
                    if(keys[i]!=autoHref){
                        param[keys[i]] =locParam[keys[i]]
                    }
                }
                window.location.href = autoHref+'?'+paramSerialize(param);
            }else{
                var __vpageid = getHashParams().__vpageid;
                if(__vpageid){
                    window.location.href = 'index.html#'+__vpageid;
                }else{
                    window.location.href = 'index.html';
                }
            }
        }
        function getWXBDinfo(){
            var jsonData = {
                   "function": "WX006",
                   "weixinid": sessionStorage.getItem("weixinid"),
                   "unionId": sessionStorage.getItem("unionId"),
                   "accountId": sessionStorage.getItem("accountId")
              };
              nfApp._ajax(jsonData,function (data) {
                  if(SUCCESS_FLAG==data.code){
                       $(".js-lognumber").val(accManage.hidelogNumber(data.idno)).attr('disabled','disabled');
                       $(".js-logn-sel").addClass('uhide');
                       accManage.acc = data.idno.trim();
                       accManage.logtype = '2';
                       accManage.cerType = '0';     
                       accManage.accoValid = true;               
                  }
              });            
        }
        function plainInit(){
           //其他方式登录初始化
           accManage = new AccManage();
           initSelCerType();
           var param = paramQuery();
           if(param.h5lock==1||localStorage.getItem("safeExit")=="1"){//手势密码跳转
               getWXBDinfo();
           } 
           if(getLocVal('_userList')){
               var userItem = accManage.userList[0];
               var lognumber = (userItem.certificatetype == '7'||userItem.certificatetype=='-1')?userItem.lognumber:accManage.hidelogNumber(Decrypt(userItem.lognumber));
               $('.js-lognumber').val(lognumber);
               $('.js-logn-sel').removeClass('uhide');
               var acc = (userItem.certificatetype == '7'||userItem.certificatetype=='-1')?userItem.lognumber:Decrypt(userItem.lognumber);
               accManage.acc = acc;//修改当前登录账号
               $('#select-cert').find('input[value="'+userItem.certificatetype+'"]').prop('checked','true');//修改其他登录方式对应的certificatetype
               accManage.setLogTypePlaceHolder(userItem.certificatetype);
               accManage.accoValid =true;
            }
        }
        function initSelCerType() {//初始化证件
            var certList =[{cName:'手机号/身份证',cVal:'0'},{cName:'昵称',cVal:'7'},{cName:'军官证',cVal:'2'},{cName:'士兵证',cVal:'3'},{cName:'户口本',cVal:'5'},
                {cName:'警官证',cVal:'9'},{cName:'中国护照',cVal:'1'},{cName:'回乡证',cVal:'4'},{cName:'文职证',cVal:'8'},{cName:'基金账号',cVal:'-1'}];
            certSelect = selectBox({
                maskName:'cerType',
                title:'请选择证件',
                trrigerEle:'.js-cert-select',//触发
                radioname:'radio-cert',
                selector:'select-cert',
                radioValKeys:'cVal',
                datakeys:'cName',
                type:'dotType',
                data:certList,
                callback:function(certVal){
                    $('.js-cert-select').data('val',certVal+'');
                    accManage.setLogTypePlaceHolder(certVal);//修改certificatetype和logType
                }
            });
        }
        function inputInit(){
            $(".clearBtn").click(function(e){//删除小按钮
                e.stopPropagation();
                if($(this).data('act')==='input'){//作用于输入框
                    var $prev = $(this).prev();
                    $prev.find("input.clearEnabled").val("");
                    $(this).addClass("uhide");
                    if($prev.find("input.clearEnabled").attr("type") !== "password"){//修改账号
                        accManage.accoValid = false;
                    }
                }else{//清除登录账号记录
                    var $parent = $(this).parent()
                    $parent.remove();
                    accManage.delUser($parent.attr('data-index'),$parent);
                }                
            });
                        
            $('.js-lognumber').bind("input focus",function(){//账号聚焦
                 $(".sel-option").removeClass("sel-icon-rotate");
                 $(".js-logn-userList").addClass("uhide");
            });
            $(".clearEnabled").bind("input", function(){//针对所有输入框
                 var val = $(this).val();
                 if($(this).attr("type") !== "password"){//修改账号
                        accManage.accoValid = false;
                  }
                 val?($(this).parent().next().removeClass("uhide")):($(this).parent().next().addClass("uhide"))
            });
            $(".clearEnabled").bind("blur", function(){//针对所有输入框
                 $(this).parent().next().addClass("uhide");
            });           
        }
        function bindLoginEvent(){
            $(".js-login").on('click',function(){
                if(!initParam()){//初始化参数失败
                    return;
                };
                loginModule.login(0);         
            });
        }
        function initParam(){//普通登录 参数处理
            var password = $.trim($(".js-pwd").val());
            if(!accManage.accoValid){//是否使用缓存账号
                var lognumber = accManage.acc = rem_bla($('.js-lognumber').val());
            }else{         
                var lognumber = accManage.acc ;
            }
            if(!checkLoginInfo(lognumber,password)){
                return false;
            }
            loginModule.param={
                "function" : "AT005",
                "logtype":accManage.logtype,
                "certificatetype" : accManage.cerType,
                "lognumber" : lognumber.trim(),
                "crypt" : "1",
                "accountId":sessionStorage.getItem("accountId"),
                "password" : Encrypt(password),
                "lastSeeMsgDate" : getLocVal("lastSeeMsgDate"),
                'interfaceversion':'2',
                "thirdpart": sessionStorage.getItem("subChannel"),
                "subOpenid": sessionStorage.getItem("subOpenid")
            };
            if(inputPicCode){
               $.extend(loginModule.param,{
                   "authcode" : $('#authcode').val()
                 });
            }
            return true;
        }
        function checkLoginInfo(lognumber,password){//普通登录检验登录信息
            if (lognumber == "") {
                $toast("请输入登录号码");
                return false;
            } else {
                if (accManage.cerType == '0') {
                    if (lognumber.length != 15 && lognumber.length != 18&&!/^1[3456789]\d{9}$/.test(lognumber)) {
                         $toast('对不起！您输入的身份证号码或手机号码格式有误');
                        return false;
                    }
                }
            }
            if (!isDefine(password)) {
                $toast('请输入密码', 1000);
                return false;
            }
           
            if(inputPicCode){
                if(!$('#authcode').val()){
                      $toast('请输入图形验证码', 1000);
                    return false;
                }
            }
            return true;
        }
        var AccManage = function(){
            //用户信息列表:只保存——lognumber/certificatetype/accountId
            this.acc = '';//当前登录账号
            this.cerType = '0';
            this.logtype = '2';
            this.accoValid =false;
            this.init =function(){
                if(this.userList.length==0){
                    inputInit();
                    return;
                }
                $('.js-logn-sel').click(function(){//用户下拉选择按钮
                    if($('.js-logn-userList').children().length==0){
                        $(this).addClass('uhide');
                        return;
                    }
                    $(this).toggleClass('sel-icon-rotate');
                    $('input.clearBtn').addClass('uhide');
                    $('.js-logn-userList').toggleClass('uhide');
                });
                this.renderHtml();
                inputInit();
             };
             this.userList =getLocVal('_userList')?JSON.parse(getLocVal('_userList')):[];//存储以前登录过的账号
         
             this.saveUser = function(_accId){//accountId
                 var self= this;
                 var _userList =  getLocVal('_userList')?JSON.parse(getLocVal('_userList')):[];;//对比缓存
                 var _isSaved = false;
                 var slognumber = (self.cerType == '7'||self.cerType=='-1')?self.acc:Encrypt(self.acc);
                 for (var i=0; i < _userList.length; i++) {
                     if(_userList[i].accountId == _accId){//客户号相同修改登录账号
                         _userList[i] = {'lognumber':slognumber,'certificatetype':self.cerType,'accountId':_accId,'crypt':"2"};
                         setLocVal('_userList',JSON.stringify(_userList));//重新保存
                         return;
                     }
                     var listLoginnumber = _userList[i].lognumber;
                 
                     if((listLoginnumber == self.acc&&_userList[i].certificatetype == self.cerType)){
                         return;
                     }
                 }
                 if(!_isSaved){//追加
                     _userList.push({'lognumber':slognumber,'certificatetype':self.cerType,'accountId':_accId,'crypt':"2"});
                     setLocVal('_userList',JSON.stringify(_userList));
                 }
             };
             //删除用户
             this.delUser =function delUser(_index,$obj){
                 var userList = this.userList;
                 var newList = [];
                 if($obj.text()== $('.js-lognumber').val()){//清除输入框
                     $('.js-lognumber').val('');
                 }
                 for (var i=0; i < userList.length; i++) {
                     if(i != _index){//重新排序
                         newList.push(userList[i]);
                     }
                 };
                 //this.userList = newList;//不需要重新赋值，index保留是原有数组的值
                 !newList.length&&$('.js-logn-sel').addClass('uhide');
                 setLocVal('_userList',newList.length?JSON.stringify(newList):'');
             };
        
             this.renderHtml = function(){
                 var self = this
                 var _lognumList = getLocVal('_userList')?JSON.parse(getLocVal('_userList')):[];
                 var _lognumStr = '';
                 for (var i=0; i < _lognumList.length; i++) {
                     var lognumber = (_lognumList[i].certificatetype == '7'||_lognumList[i].certificatetype=='-1')?_lognumList[i].lognumber:self.hidelogNumber(Decrypt(_lognumList[i].lognumber));
                     _lognumStr += '<li class="ub user-item" data-index="'+i+'">'
                                +'<div class="ub-f1">'+lognumber+'</div>'
                                +'<img src="${pageContext.request.contextPath}/moible/static/images/clear.png" style="width:1.2em;height:1.2em;" class="clearBtn"/>'
                                +'</li>';
                 };
                 $('.js-logn-userList').append(_lognumStr);              
                 $('.user-item').on('click',function(){
                     $('.js-lognumber').val($(this).text());
                     $('.js-logn-userList').toggleClass('uhide');
                
                     var curIndex = $(this).data('index');
                     self.accoValid =true;
                      var lognumber = (_lognumList[curIndex].certificatetype == '7'||_lognumList[curIndex].certificatetype=='-1')?_lognumList[curIndex].lognumber:Decrypt(_lognumList[curIndex].lognumber);
                     self.acc = lognumber;//修改当前登录账号

                     $('#select-cert').find('input[value="'+self.userList[curIndex].certificatetype+'"]').prop('checked','true');//修改其他登录方式对应的certificatetype
                     self.setLogTypePlaceHolder(self.userList[curIndex].certificatetype);////修改当前登录类型及logType
                 });
             }
             this.hidelogNumber = function(logNumber) {
                 if (logNumber.length > 8) {
                     var start = logNumber.substr(0, 4);
                     var end = logNumber.substr(-4, 4);
                     var str = start;
                     for (var i = 0; i < logNumber.length - 8; i++) {
                         str += "*";
                     }
                     return str + end;
                 } else {
                     var start = logNumber.substr(0, 2);
                     var end = logNumber.substr(-2, 2);
                     var str = start;
                     for (var i = 0; i < logNumber.length - 8; i++) {
                         str += "*";
                     }
                     return str + end;
                 }
             }
             this.setLogTypePlaceHolder = function(certVal){
                 var _cerType = this.cerType = certVal;
                 this.logtype = '2';
                 switch(_cerType){
                     case '0':
                        typeDesc = "手机号/身份证";
                        break;
                     case '1':
                        typeDesc = "中国护照";
                        break;
                      case '2':
                        typeDesc = "军官证"; 
                        break;
                      case '3':
                        typeDesc = "士兵证"; 
                        break;
                      case '4':
                        typeDesc = "回乡证"; 
                        break;
                      case '5':
                        typeDesc = "户口本";                 
                        break;
                      case '7':
                        this.logtype = 'N';//昵称登录
                        typeDesc = "昵称";       
                        break;
                      case '8':
                        typeDesc = "文职证";
                        break;
                      case '9':
                        typeDesc = "警官证";
                        break;
                      case '-1':  
                        this.logtype = '1';//基金账号登录
                        typeDesc = "基金账号";               
                 }
                 $(".js-lognumber").attr('placeholder',typeDesc);
             }
             this.init();
        }
        
        function setLogTypePlaceHolder(selVal){
                var $input =$('#lognumber')
                var palaceholder = ''
                if(selVal==='0'){
                    palaceholder ='请输入身份证号码';
                }else if(selVal==='2'){
                    palaceholder ='请输入军官证';
                }else if(selVal==='3'){
                    palaceholder ='请输入士兵证';
                }else if(selVal==='5'){
                    palaceholder ='请输入户口本';
                }else if(selVal==='7'){
                    palaceholder ='请输入昵称';
                }else if(selVal==='9'){
                    palaceholder ='请输入警官证';
                }
                $input.attr('placeholder',palaceholder);
            }
            //显示图形验证码
            function showPicCode(){
                $('#picCodeItem').removeClass('uhide');
                $authcodeImg = $('#authcode').next();
                $authcodeImg.attr('src',getRootPath()+'/nffund/authcode.jpg?t='+(new Date()).getTime())
                var sign = "",mobile="",authCode="";
                //获取短信验证码
                $authcodeImg.on('click',function(){
                    $authcodeImg.attr('src',getRootPath()+'/nffund/authcode.jpg?t='+(new Date()).getTime())
                });
            }
            
           

    function savePiwikPlainLogin(data){
        try{
           var piwikParam = {
            };
            if(loginModule.param.logtype=="N"){//昵称
                piwikParam = $.extend(piwikParam,{
                    'nickname':loginModule.param.lognumber
                });
            }else if(loginModule.param.logtype=="-1"){//基金账号
                piwikParam = $.extend(piwikParam,{
                    'fund_acco':loginModule.param.lognumber
                });                
            }
            else{//其他
                if(loginModule.param.certificatetype==0&&loginModule.param.lognumber&&loginModule.param.lognumber.length==11){
                     piwikParam = $.extend(piwikParam,{
                        'mobile':loginModule.param.lognumber
                    });                     
                }else{
                  piwikParam = $.extend(piwikParam,{
                    'ID_no':loginModule.param.lognumber,
                    'ID_type':loginModule.param.certificatetype
                });                    
                }                   
            }            
            if(data.code != SUCCESS_FLAG){
                piwikParam = $.extend(piwikParam,{
                    'errmsg':data.message
                });
                var customData = {'type':'login','info':piwikParam};
                setLocVal("customData",json2str(customData));
                piwikSetCustomData();                 
                piwikTrackEvent(Piwik_Event_Quota.login.category,Piwik_Event_Quota.login.fail.action,data.message);                       
            }else{
                var customData = {"type":"login","info":piwikParam};   
                setLocVal("customData",json2str(customData));             
                piwikSetCustomData();                  
                piwikTrackEvent(Piwik_Event_Quota.login.category,Piwik_Event_Quota.login.succ.action,"");                      
            }              
        }catch(e){}
    }            
        </script>
              
    
</body></html>